// @ts-ignore
/* eslint-disable */
import request from '@/utils/request';

const path = require('path');
const fs = require('fs');
//查询文章
export async function getTopicInfoList(params: any) {
  const pageParams = {
    page: params.page,
    pageSize: params.pageSize,
    roleId:params.roleId
  };
  return request('/api/v1/topic/getTopicInfoList', {
    method: 'POST',
    params: {
      ...pageParams,
    },
    data: {
      ...params,
    },
  });
}

//文件上传
export async function batchUpload(params: any) {
  return request('/api/v1/topic/batchUpload', {
    method: 'POST',
    data: params,
  });
}

//修改文章属性
export async function change(params: any) {
  return request('/api/v1/topic/change', {
    method: 'POST',
    data: params,
  });
}

//新增文章
export async function insertTopic(params: any) {
  return request('/api/v1/topic/insertTopic', {
    method: 'POST',
    data: params,
  });
}
//查询单个文章
export async function selectOne(params: any) {
  return request('/api/v1/topic/selectOne', {
    method: 'POST',
    data: params,
  });
}

//修改文章
export async function updateTopic(params: any) {
  return request('/api/v1/topic/updateTopic', {
    method: 'POST',
    data: params,
  });
}
//预览文章
export async function cacheTopic(params: any) {
  return request('/api/v1/topic/cacheTopic', {
    method: 'POST',
    data: params,
  });
}

//修改属性
export async function topicChange(params: any) {
  return request('/api/v1/topic/change', {
    method: 'POST',
    data: params,
  });
}
//移动文章
export async function moveTopic(params: any) {
  return request('/api/v1/topic/moveTopic', {
    method: 'POST',
    params: params,
  });
}

//审核
export async function topicApprove(params: any) {
  return request('/api/v1/topic/approve', {
    method: 'POST',
    data: params,
  });
}

//删除
export async function topicDelete(params: any) {
  return request('/api/v1/topic/delete', {
    method: 'POST',
    params: params,
  });
}

//多删除
export async function batchDelete(params: any) {
  return request('/api/v1/topic/batchDelete', {
    method: 'POST',
    data: params,
  });
}

//删除
export async function topicSelectOne(params: any) {
  return request('/api/v1/topic/selectOne', {
    method: 'POST',
    params: params,
  });
}

export async function base64File(filePath) {
  // 读取文件数据
  return request('/api2/api/list', {
    method: 'GET',
    params: { filePath: filePath },
  });
}
